package com.euro.video.phone.entities;

import java.awt.Dimension;
import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name = "publicite", schema = "evp_db")
@NamedQueries({
	@NamedQuery(name="listPublicitesParDates", query="select pub from Publicite pub where pub.creation< :fin and pub.creation>= :debut"),
	@NamedQuery(name="listPublicitesALaUne", query="select pub from Publicite pub where pub.aLaUne=true"),
	@NamedQuery(name="imagePublicite", query="select pub.image from Publicite pub where pub.titre= :titre")
})
public class Publicite implements Serializable {
	private static final long serialVersionUID = 1L;
	@Id
	@Column(length = 64, insertable = false)
	private String titre;
	@Column(updatable = true, insertable = true, nullable = false, columnDefinition="longtext")
	private String description;
	@Column(updatable = true, insertable = true, nullable = false)
	private boolean aLaUne;
	@Column(updatable = true, insertable = true, nullable = true, columnDefinition = "mediumblob")
	private byte[] image;
	@Column(updatable = false, insertable = true, nullable = false)
	private Date creation;
	private volatile Dimension imageSize;

	public Publicite() {
		aLaUne = false;
	}

	public String getTitre() {
		return titre;
	}

	public void setTitre(String titre) {
		this.titre = titre;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public boolean isaLaUne() {
		return aLaUne;
	}

	public void setaLaUne(boolean aLaUne) {
		this.aLaUne = aLaUne;
	}

	public byte[] getImage() {
		return image;
	}

	public void setImage(byte[] image) {
		this.image = image;
	}

	public Date getCreation() {
		return creation;
	}

	public void setCreation(Date creation) {
		this.creation = creation;
	}

	public Dimension getImageSize() {
		return imageSize;
	}

	public void setImageSize(Dimension imageSize) {
		this.imageSize = imageSize;
	}

}
